//
//  MFFreedomButton.m
//  MFiPhoneSDK
//
//  Created by 孟令博 on 16/3/29.
//  Copyright © 2016年 孟令博. All rights reserved.
//

#import "MFFreedomButton.h"

@implementation MFFreedomButton

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self awakeFromNib];
    }
    return self;
}

- (void)awakeFromNib
{
    [super awakeFromNib];
    
    //默认字体居中
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
}

- (CGRect)imageRectForContentRect:(CGRect)contentRect
{
    CGRect imageContentRect = self.imageRect;
    imageContentRect.origin.x += contentRect.origin.x;
    imageContentRect.origin.y += contentRect.origin.y;
    
    return imageContentRect;
}

- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
    CGRect titleContentRect = self.labelRect;
    titleContentRect.origin.x += contentRect.origin.x;
    titleContentRect.origin.y += contentRect.origin.y;
    
    return titleContentRect;
}

@end
